#pragma once

#include <string_view>
#include <memory>

#include "util/fs.h"
#include "util/net/http-controller.h"

#include "book/book-declare.h"


class AbcServer;
class AbcArticleManagerSynchronizer;

namespace prefix::article
{

static const std::string_view Article("/book/abc-of-cpp");
static const std::string_view ArticleControll("/book-controll");

} // namespace prefix

class AbcArticleManagerController : public HttpController
{
public:
    AbcArticleManagerController(AbcServer &server);

    virtual ~AbcArticleManagerController();

    virtual void handleHttpRequest(const HttpRequest &request, HttpResponse &response) override;

    void notifyDataGenerated(std::shared_ptr<book::Book> book);

private:
    void handleArticleRequest(const HttpRequest &request, HttpResponse &response);

    void handleControllRequest(const HttpRequest &request, HttpResponse &response);

private:
    AbcServer &server_;
    AbcArticleManagerSynchronizer *manager_ = nullptr;
    std::shared_ptr<book::Book> book_;
};
